package org.caowei.samples.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "exam_user_subject")
public class UserSubject implements Serializable{

	private static final long serialVersionUID = 2421834530840681471L;

//	@Id
//	@Column(name = "user_id")
//	private String userId;
//	
//	@Column(name = "sub_id")
//	private Integer subId;
//	
	@Id
	@ManyToOne(cascade = {CascadeType.DETACH,CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name = "user_id",insertable=false,updatable=false)
	private User user;
	
	@Id
	@ManyToOne(cascade = {CascadeType.DETACH,CascadeType.PERSIST,CascadeType.MERGE})
	@JoinColumn(name = "sub_id",insertable=false,updatable=false)
	private Subject subject;

//	public UserSubject(String userId, Integer subId, User user, Subject subject) {
//		this.userId = userId;
//		this.subId = subId;
//		this.user = user;
//		this.subject = subject;
//	}

	public UserSubject() {
		super();
	}

//	public String getUserId() {
//		return userId;
//	}
//
//	public void setUserId(String userId) {
//		this.userId = userId;
//	}
//
//	public Integer getSubId() {
//		return subId;
//	}
//
//	public void setSubId(Integer subId) {
//		this.subId = subId;
//	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Subject getSubject() {
		return subject;
	}

	public void setSubject(Subject subject) {
		this.subject = subject;
	}
}
